package com.atguigu.spzx.order.api;

import com.atguigu.spzx.common.result.Result;
import com.atguigu.spzx.common.result.ResultCodeEnum;
import com.atguigu.spzx.common.utils.PageUtils;
import com.atguigu.spzx.order.dto.OrderInfoDetailRespDto;
import com.atguigu.spzx.order.entity.OrderInfo;
import com.atguigu.spzx.order.service.OrderInfoService;
import com.atguigu.spzx.order.vo.OrderInfoDetailRespVo;
import com.atguigu.spzx.order.vo.OrderInfoQueryRespVo;
import com.atguigu.spzx.order.vo.OrderInfoSaveReqVo;
import com.atguigu.spzx.order.vo.TradeRespVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * OrderInfoController
 * </p>
 *
 * @author flyduck
 * @since 2023/11/6
 */
@Api(tags = "订单管理接口")
@RestController
@RequestMapping("/api/order/orderInfo")
public class OrderInfoApiController {

    @Autowired
    private OrderInfoService orderInfoService;

    @ApiOperation("更新订单状态")
    @GetMapping("/auth/updateOrderStatusByOrderNo/{orderNo}/{orderStatus}")
    public void updateOrderStatus(@PathVariable(value = "orderNo") String orderNo ,
                                  @PathVariable(value = "orderStatus") Integer orderStatus) {
        orderInfoService.updateOrderStatusByOrderNo(orderNo,orderStatus);
    }

    @ApiOperation("获取订单信息")
    @GetMapping("auth/getOrderInfoByOrderNo/{orderNo}")
    public OrderInfoDetailRespDto getOrderInfoByOrderNo(@PathVariable String orderNo) {
        OrderInfoDetailRespDto respDto = orderInfoService.getOrderInfoByOrderNo(orderNo) ;
        return respDto;
    }

}
